package net.eascn.Editor.view
{
	import flash.display.Sprite;
	import flash.geom.Transform;
	
	import mx.containers.Canvas;

	public class BlockTile extends Canvas
	{
		public function BlockTile()
		{
			super();
		}
	
		private var _width:int =0;
		private var _height:int = 0;
		private var sp:Sprite = new Sprite();
		override public function set width(value:Number):void
		{
			_width = value;
			updateSP()
			super.width = value;
		}
		override public function get width():Number
		{
			
			sp.transform = this.transform;
			return sp.width;
			
		}
		override public function set height(value:Number):void
		{
			_height = value;
			updateSP()
			super.height = value;
		}
		
		override public function get height():Number
		{
			sp.transform = this.transform;
			return sp.height;
		}
		
		override public function get rotation():Number
		{
			sp.transform = this.transform;
			return sp.rotation;
		}
		
		protected function updateSP():void
		{
			sp.graphics.beginFill(0x535353);
			sp.graphics.drawRect(0,0,_width,_height);
			sp.graphics.endFill();
		}
		
		public function set backgroundColor($value:uint):void
		{
			this.graphics.beginFill($value);
			this.graphics.drawRect(0,0,width,height);
			this.graphics.endFill();
		}
		
	}
}